const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
    devServer: {
        open: false,
        host: '0.0.0.0',
        port: 39080,
        https: false,
        hotOnly: false,
        proxy: {
            // 配置跨域
            '/api': {
                target: 'https://imissu.herokuapp.com/api/',
                ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/api': ''
                }
            }
        }
    },
    configureWebpack: {
        plugins: [
            new CopyWebpackPlugin({
                patterns: [
                    { from: 'node_modules/cesium/Build/Cesium/Workers', to: 'Workers' },
                    { from: 'node_modules/cesium/Build/Cesium/ThirdParty', to: 'ThirdParty' },
                    { from: 'node_modules/cesium/Build/Cesium/Assets', to: 'Assets' },
                    { from: 'node_modules/cesium/Build/Cesium/Widgets', to: 'Widgets' }
                ],
            }),
            new webpack.DefinePlugin({
                // Define relative base path in cesium for loading assets
                CESIUM_BASE_URL: JSON.stringify('')
            })
        ],
        module: {
            rules: [
                // {
                //     test: /\.mjs$/,
                //     include: /node_modules/,
                //     type: "javascript/auto"
                // }
            ]
        }
    }
}